<#import "/spring.ftl" as spring/>
<#include "commonScript.ftl"/>
<script type="text/javascript">
    var formColumnSetting = [
        {
            index: "bizType",
            name: "bizType",
            type: "dropdown",
            data: [["进口", "I"], ["出口", "E"]],
            label: "业务类型"
        }, {
            index: "supId",
            name: "supId",
            label: "报关行",
            type:'dropdown',
            dropdownType: "ajax",
            keyWordName:'key',
            url: "<@spring.url '/order-dropdown/supCompanyByKey'/>",
            minLength: 0,
            success: function (data) {
                data = data.results;
                var array = [];
                $.each(data, function (i, n) {
                    array.push([n["name"], n["value"]]);
                });
                return array;
            }
            <#if isSup!false>
            ,hidden:true
            </#if>
        }, {
            index: "businessNo",
            name: "businessNo",
            label: "业务编码"
        }, {
            index: "contaNo",
            name: "contaNo",
            label: "集装箱号"
        }, {
            name: "company_co",
            label: "收发货人",
            type: "dropdown",
            dropdownType: "ajax",
            keyWordName:'key',
            url: "<@spring.url '/order-dropdown/company'/>",
            minLength: 0,
            success: function (data) {
                data = data.results;
                var array = [];
                $.each(data, function (i, n) {
                    array.push([n["text"], n["value"]]);
                });
                return array;
            }
        }, {
            index: "custId",
            name: "custId",
            label: "实际委托人",
            type:'dropdown',
            dropdownType: "ajax",
            keyWordName:'key',
            url: "<@spring.url '/order-dropdown/cusCompanyByKey'/>",
            minLength: 0,
            success: function (data) {
                data = data.results;
                var array = [];
                $.each(data, function (i, n) {
                    array.push([n["name"], n["value"]]);
                });
                return array;
            }
            <#if isCust!false>,
            hidden : true
            </#if>
        },  {
            index: "sno",
            name: "sno",
            label: "报关单号"
        },  {
            index: "docStatus",
            name: "docStatus",
            label: "单证发放状态",
            type:'dropdown',
            data: [["待申领", "WAIT"], ["申领中", "RECEIVING"], ["已申领", "RECEIVED"], ["已发放", "HANDED_OUT"]]
        },  {
            index: "paymentTimeBegin",
            name: "paymentTimeBegin",
            label: "支付时间从",
            type:'date'
        },  {
            index: "paymentTimeEnd",
            name: "paymentTimeEnd",
            label: "支付时间至",
            type:'date'
        }

    ];

    var buttonSetting = [
        {
            id: "exportDocRecordExcl",
            value: "导出单证发放记录",
            click: function () {
                var finputs = $("form input:not(:button)");
                var url = "<@spring.url '/business/declaOpRec/downloadDocHoRecord'/>";
                var inputsHtml = "";
                var existsQuery = false;
                for (var i = 0; i < finputs.length; i++) {
                    var $inp = $(finputs[i]);
                    var val = $inp.val();
                    if(val && val.trim().length > 0){
                        existsQuery = true;
                    }
                    inputsHtml += "<input type='hidden' name='"+$inp.attr("name")+"' value='"+val+"'/>"
                }
                if(!existsQuery){
                    layer.msg("请输入查询条件");
                    return;
                }
                jQuery('<form action="'+ url +'" method="post" style="display: none">'+inputsHtml+'</form>').appendTo('body').submit().remove();
            }
        }];

</script>

